import instacne from "../request";
import type { Ref } from "vue";

/* 
/resource/list
分页模糊查询后台资源
 */
interface IResourceAllListParams {
  categoryId?: string | Ref<string>;
  nameKeyword?: string | Ref<string>;
  urlKeyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}
interface IResourceListItem {
  categoryId: number;
  createTime: string;
  description: string;
  id: number;
  name: string;
  url: string;
}

interface IResourceListRes {
  list: IResourceListItem[];
  pageNum: number;
  pageSize: number;
  total: number;
  totalPage: number;
}

const getResourceAllList = (
  data?: IResourceAllListParams
): Promise<IResourceListRes> => {
  return instacne.get("/resource/list");
};

export { getResourceAllList };
export type { IResourceListItem };
